#include ("/_includes/_layout.html")
#@layout("一物一码激活", "wxmall,点步科技", "Wxmall社区","wxmall") 
#define content()
<div class="wrapper wrapper-content">
	<div class="content ibox-content">
		<!-- <div class="panel-body">
			<div style="float: left; margin-right: 20px;">
			<table>
				<tr>
					<td><a href="#(webctx)/marketcode/marketcodecodeactive/edit" id="add-follows" class="btn btn-success">新增</a></td>
					<td><input style="margin:0 10px" type="text" name="redpack_txt" id="redpack_txt" placeholder="" class="control-inline" /></td>
					<td><button id="myqueryBtn" class="btn btn-success btn-sm">查询</button></td>
				</tr>
			</table>
			</div>
			<div id="pager" class="jqpager" style="margin-bottom: 1px;"></div>	
		</div> -->
		<table id="mainTable" class="table table-striped table-bordered bootstrap-datatable datatable" border="0">
		  <thead>
			  <tr>
				<th><input type="checkbox" id="all" title="全选/反选" style="margin-right: 4px; vertical-align: middle;"/></th>			  	
		        <th>申请单号</th>
		        <th>活动名称</th>
		        <th>商品品牌</th>
		        <th>商品标题</th>
		        <th>商品条码</th>
		        <th>小程序appid</th>
		        <!-- <th>小程序path</th>
		        <th>小程序版本</th> -->
		        <th>创建时间</th>
				<th>操作</th>
			  </tr>
		  </thead>   
		  <tbody class="itemsLotGrid"></tbody>
	  	</table>
	</div>   
</div>
<script type="text/html" id="item_table_tr_tpl">
{{each list as item i}}
		<tr class="package">
                <td><input type="checkbox" class="commchk" id="checkbox_{{item.id}}" style="margin-right: 4px; vertical-align: middle;"/></td>
                <td>{{item.applicationId}}</td>
                <td>{{item.activityName}}</td>
                <td>{{item.productBrand}}</td>
                <td>{{item.productTitle}}</td>
                <td>{{item.productCode}}</td>
                <td>{{item.wxaAppid}}</td>
                <!--<td>{{item.wxaPath}}</td>
                <td>{{item.wxaType}}</td>-->
                <td>{{item.created}}</td>
			<td><a id="edit#{{item.id}}" href="javascript:void(0)">激活明细</a>
<a id="config#{{item.id}}" href="javascript:void(0)">配置</a></td>
		</tr>
{{/each}}  
</script>  
<script type="text/template" id="table_noresult_tr_tpl">
	<tr class="package"><td colspan="11" class="center">没有结果集</td></tr>
</script>
<script type="text/javascript">
var configDialog = null;
$(document).ready(function() {
	var params = {};
	var flag = true;
	params.active = $("#a_status_sel").val();
	var table = new obz.TableView("pager", obz.ctx + "/marketcode/marketcodecodeactive/list", params, function(resp){
		$(".itemsLotGrid").empty();
		if(resp && resp.list && resp.list.length>0){
			$('.itemsLotGrid').html(template('item_table_tr_tpl', resp));
			//初始化checkbox点击事件
			TBatch.checkCheckbox();
			TBatch.initCheckboxClick();
			TBatch.initOptEvent(TableOpt.init());
		}else{
			$(".itemsLotGrid").append($("#table_noresult_tr_tpl").html());
		}
	});
	table.init();
	$("#myqueryBtn").click(function (){
		var params = {};
		params.redpackTxt = $("#redpack_txt").val();
		params.active = $("#a_status_sel").val();
		table.setParams(params);
		table.init();
	});
	var TableOpt = {
		edit : function(param){
			var id = param[1];
			obz.open("激活明细", "#(webctx)/marketcode/marketcodecodeactive/activercd/?id="+id);
		},
		config : function(param){
			var id = param[1];
			configDialog = obz.open("配置", "#(webctx)/marketcode/marketcodecodeactive/config/?id="+id);
		},
		init : function(){
			var optArray = new Array();
			optArray.push(this.edit);
			optArray.push(this.config);
			return optArray; 
		}
	}
});
</script>
#end